package com.bkhc.common.entity;

import com.bkhc.common.enu.SexEnum;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Entity
@Data
@Table(name = "tbl_umc_user")
@EntityListeners(AuditingEntityListener.class)
public class User implements Serializable {
    private static final long serialVersionUID = 1L;
    /**AccountController
     * id
     */
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Id
    private int id ;
    @Column(name = "user_id")
    private String userId ;

    @Column(name = "username")
    private String username;

    @Column(name = "status")
    private String status;

    @Column(name = "invite_code")
    private String inviteCode;

    @Column(name = "full_name")
    private String fullName;

    @Column(name = "sex")
    private SexEnum sex;

    @Column(name = "acount_type")
    private String acountType;

    @Column(name = "phone")
    private String phone;

    @Column(name = "nick_name")
    private String nickname;

    @Column(name = "email")
    private String email;

    @Column(name = "address")
    private String address;

    @Column(name = "post_code")
    private String postCode;

    @Column(name = "creator",updatable = false)
    private String creator;

    @Column(name = "create_date",updatable = false)
    @CreatedDate
    private Date createDate;

    @Column(name = "updator")
    private String updator;

    @Transient
    private List<Role> roles;

    @Transient
    @JsonIgnore
    private ApplyInfomation infomation;

    @LastModifiedDate
    @Column(name = "update_date")
    private Date updateDate;

    /**
     * 0 普通用户  1 业务合伙人 2 产品合伙人 3 个人业务合伙人
     */
    @Column(name = "user_type")
    private Integer userType;

    @Transient
    private List<Address> addressList;

}
